package com.hznu.jspFinal.service;

import com.hznu.jspFinal.dao.MajorMapper;
import com.hznu.jspFinal.entity.Major;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author jamesZhan
 */
@Service
public class MajorServiceImpl implements MajorService {

    @Autowired
    private MajorMapper majorMapper;

    @Override
    public void insert(Major major) {
        majorMapper.insert(major);
    }

    @Override
    public void delete(Integer id) {
        majorMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void update(Major major) {
        majorMapper.updateByPrimaryKey(major);
    }

    @Override
    public Major selectByPrimaryKey(Integer id) {
        return majorMapper.selectByPrimaryKey(id);
    }

    @Override
    public Major selectByName(String name) {
        return majorMapper.selectByName(name);
    }

    @Override
    public List<Major> selectAllMajor(Integer departmentid) {
        return majorMapper.selectAllMajor(departmentid);
    }
}
